<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	String contextPath = request.getContextPath();
%>
<jsp:include page="/WEB-INF/jsp/common/fadeout.jsp"></jsp:include>
<div id="log_layout" class="easyui-layout" data-options="fit:true" style="width:600px;height:400px;">   
    <div data-options="region:'center',title:'商品管理',split:'false'" >
    	<table id="pro_info_datagrid"></table>
    </div>
 </div>
 <input type="hidden" name="filePath" value="${filePath}"/> 
 <script>
 $(function(){
	 	//$('#main_layout').layout('remove','east');
		$("#pro_info_datagrid").datagrid({    
		    url:'repertory_manager/customerProInfo.do', 
		    loadMsg:'数据加载中···',
		    fit:'true',
		    idField:'id',
		    pagination:true,
		    checkOnSelect : true,
			selectOnCheck : true,
		    columns:[[
		    {
				field : "ck",
				checkbox : false
			}, {
				field : "id",
				hidden : true
			},     
		    {
				field:'pro_no',
				title:'商品编码',
				width:270,
				align:'center',
		    },     
		    {
				field:'pro_name',
				title:'商品名称',
				width:180,
				align:'center',
		    },
		     {
		    	 field:'warehouse',
		    	 title:'有效仓库',
		    	 width:180,
		    	 align:'center'
		    },{
		    	 field:'location',
		    	 title:'区位',
		    	 width:160,
		    	 align:'center'
		    },{
		    	 field:'loc_no',
		    	 title:'库位号',
		    	 width:160,
		    	 align:'center'
		    },{
		    	field:'size',
		    	title:'尺寸',
		    	width:200,
		    	align:'center',
		        formatter: function(value,row,index){
		        	return row.length+"x"+row.width+"x"+row.height;
		    }},{
		    	 field:'weight',
		    	 title:'重量',
		    	 width:140,
		    	 align:'center'
		    },{
		    	 field:'pre_postage',
		    	 title:'预估邮费',
		    	 width:140,
		    	 align:'center'
		    },{
		    	 field:'pro_number',
		    	 title:'数量',
		    	 width:140,
		    	 align:'center'
		    },{
		    	 field:'image_name',
		    	 title:'图片',
		    	 width:180,
		    	 align:'center',
		    	 formatter:function(value,row,inedex){
		    		 if(value==null || value==""){
		    			 return "未上传";
		    		 }else{
		    			 return "<a target='_blank' href="+$("input[name='filePath']").val()+value+">点击查看</a>"; 
		    		 }
		    		 
		    	 }
		    },{
	   	    	field:'create_tm',
	   	    	title:'入库时间',
	   	    	width:280,
	   	    	align:'center',
	   	        formatter: function(value,row,index){
	   	        	return getTime(value);
	   	        }}
		    ]],
		    fitColumns:true
		    //toolbar:'#cart_tb'
		});  	
	});
 function getTime(old) {
		var date = new Date(old);
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		if (month < 10)
			month = "0" + month;
		var day = date.getDate();
		if (day < 10)
			day = "0" + day;
		var hour = date.getHours();
		if (hour < 10)
			hour = "0" + hour;
		var minute = date.getMinutes();
		if (minute < 10)
			minute = "0" + minute;
		var seconds = date.getSeconds();
		if (seconds < 10)
			seconds = "0" + seconds;
		var newDate = year + "-" + month + "-" + day + " " + hour + ":" + minute
				+ ":" + seconds;
		return newDate;
	}
 </script>
